<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Ijazah extends CI_Controller {
	
	function __construct(){
		parent::__construct();
		$this->load->model('mdl_ijazah');
		//$this->load->model('mdl_fakultas');
		//$this->load->model('mdl_prodi');
		//$this->output->enable_profiler(true);
	}
	
	function index(){
		$this->load->view('ijazah');
	}
	
	# grid
	function grid(){
		$data = $this->mdl_ijazah->getdata();
		echo $this->mdl_ijazah->togrid($data['row_data'], $data['row_count']);
	}
	
	/* function grid_detail($id){
		$data = $this->mdl_khs->getdata_detail($id);
		echo $this->mdl_khs->togrid($data['row_data'], $data['row_count']);
	} */
	
	function laporan_pdf($kode){
		 
		 $data['kd_mahasiswa'] = $kode;
		 
		 $this->load->library('HTML2PDF');
		 $html2pdf = new HTML2PDF('L', 'Letter', 'fr');
		 $html2pdf->setDefaultFont('Arial');
		
		//filter
		#get filter
		/* $fil['kd_fakultas'] = $kd_fakultas;
		$fil['kd_prodi'] = $kd_prodi;
		$fil['tahun'] = $tahun;
		$fil['nim'] = $nim; */
		
		 //$data['nama'] = 'indriyanto';
		 $data['namaUniv'] = 'UNIVERSITAS SUBANG';
		 $data['alamatUniv'] = 'Jln. Perkutut Kotaraja, Telp.(0967)581562';
		 $data['kotaUniv'] = 'Subang, Jawa Barat';
		 
		 // ambil data dari tabel
		$data['data_pdf'] = $this->mdl_ijazah->get_pdf($kode);
		
		/* if (count($da['row'])==0){
			echo "Data Tidak Tersedia";
			return;
		} */
		
		
		 $konten = $this->load->view('ta/ijazah_format',$data,true);
		
         $html2pdf->writeHTML($konten, false);
        
		 $html2pdf->Output('exemple00.pdf');
	}
}